home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++,comp.lang.c,comp.os.ms-windows.programmer.misc
- Path: uu4news.netcom.com!friend!news
- From: rich@kastle.com (Richard Krehbiel)
- Subject: Re: fastest code
- Message-ID: <1996Apr11.145549.627@friend.kastle.com>
- Sender: news@friend.kastle.com (News)
- Reply-To: rich@kastle.com
- Organization: Kastle Development Associates
- X-Newsreader: Forte Free Agent 1.0.82
- References: <316112A2.7D37@public.sta.net.cn> <4k4ll5$fq@solutions.solon.com> <4ke5v6$17k@samba.rahul.net> <1996Apr10.110121.6784@friend.kastle.com> <4kgbmj$j3j@solutions.solon.com>
- Date: Thu, 11 Apr 1996 15:56:57 GMT
-
- seebs@solutions.solon.com (Peter Seebach) wrote:
-
- >In article <1996Apr10.110121.6784@friend.kastle.com>,
- >Richard Krehbiel <rich@kastle.com> wrote:
- >>Oliver Hellwig <hellwig@rahul.net> wrote:
- >>> for (i=0; i<16; i++)
- >>> prom[i] = prom[i+i];
-
- >>>The output of the compiler left the loop but removed the
- >>>assignment!
-
- >>I suspect a proper "volatile" declaration on "prom" might have fixed
- >>this, i.e. if "prom" is currently declared "char prom[16]" then it
- >>should be declared "volatile char prom[16]". I would not consider
- >>this an optimizer bug in Watcom.
-
- >HUH? the code as written has a clear effect, which is to shove all of
- >the elements of an array over one. It certainly is an optimizer bug.
-
- >Read the code carefully; the 2nd reference to prom[] uses a different
- >index into the array. This is not a meaningless statement.
-
- Okay, okay, that's it, I quit. I'm not going to post any more.
- Further, I think I'm going to quit my programming job, buy myself a
- tiny shack in Montana and just build pipe bombs...
-
- I read it as just prom[i] = prom[i], no i+i; since it was part of a
- device driver, the name "prom" made me think it was a hardware PROM
- and perhaps this little loop had some hardware effect. In fact, I
- wrote exactly this loop once whose purpose was to initialize the
- parity bits in memory, but be non-destructive in case it was just a
- restart and not a power-on.
-
- --
- Richard Krehbiel, Kastle Systems, Arlington VA USA
- rich@kastle.com (work) or richk@mnsinc.com (personal)
-
-